<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html>
	<head>
		<title>编辑排课</title>
		<meta name="decorator" content="default"/>
		<script type="text/javascript">
			$(function() {
				//初始化表单验证
				$("#inputForm").initValidform();
				
				$('#btnCancel').click(function(){
					var api = top.dialog.get('timeDialog');
					api.close().remove();
				});
				
				$('#btnSubmit').click(function(){
					if($('#ondatePre').val()==$('#ondate').val()
						&& $('#sectionPre').val()==$('#section').val()){
						
						var d = dialog({ content: '调整时间不能和以前一样！' }).show();
					    setTimeout(function () {
					        d.close().remove();
					    }, 2000);
					    
						return false;
					}
					
					return true;
				});
				
				$('#sectionId').change(function(){
		        	var selected = $(this).children('option:selected');
		        	$('#section').val(selected.text());
		        });
				
				$('#ondatePre').val($('#ondate').val());
				$('#sectionPre').val($('#section').val());
			});
			
			function save(){
				/**页面刷新**/
				var win = top;
				if(top.frames && top.frames['mainframe']){
					win = top.frames['mainframe'];
				}
				win.location.reload();
				/**关闭对话框**/
				var api = top.dialog.get('timeDialog');
				api.close().remove();
			}
		</script>
		<style type="text/css">
			body{padding:0px;margin:0px !important;}
			.tab-content{overflow:inherit !important; height:210px;}
		</style>
	</head>
	
	<body class="mainbody">
		${script}
		<form:form id="inputForm" modelAttribute="course" action="${ctx}/qd/course/timesave?mode=${mode}&p1=${p1}&p2=${p2}" method="post" class="form-horizontal">
			<form:hidden path="id"/>
			<input id="ondatePre" name="ondatePre" type="hidden">
			<input id="sectionPre" name="sectionPre" type="hidden">
			
			<div class="tab-content" style="border: none;">
           		<dl>
                   <dt>上课时间</dt>
                   <dd>
	                   <div class="date-input">
	                    	<i></i>
	                    	<fmt:formatDate value="${course.ondate}" pattern="yyyy-MM-dd" var="ondate"/>
							<form:input path="ondate" htmlEscape="false" value="${ondate}" maxlength="50" disabled="${readonly }" class="required" cssClass="input-build normal-build"  onfocus="WdatePicker()" datatype="/^\s*$|^\d{4}\-\d{1,2}\-\d{1,2}$/" nullmsg="请输入上课日期" errormsg="请输入上课日期" sucmsg=" "/>
	                   	</div>
						<div class="rule-single-select single-select">
	                            <form:select path="sectionId" htmlEscape="false" class="required" disabled="${readonly }"  cssClass="input normal" datatype="*" nullmsg="请输入上课时段" errormsg="请输入上课时段" sucmsg=" ">
								<form:option value="">请选择...</form:option>
								<form:options items="${sectionList}" itemLabel="name" itemValue="id"/>
							</form:select>
							<form:hidden path="section"/>
	                   </div>
                   </dd>
               </dl>
        	</div>

			<hr style="height:1px;border:none;border-top:1px solid #e4e4e4;">
				
			<!--工具栏-->
			<div class="page-footer" style="padding:0px !important; text-align: center;">
				<div class="btn-wrap">
					<input type="submit" name="btnSubmit" value="提交" id="btnSubmit" class="btn" /> 
					<input name="btnCancel" type="button" value="取消" id="btnCancel" class="btn yellow" />
				</div>
			</div>
			<!--/工具栏-->
		</form:form>
	</body>
</html>

